

/**
 * @name Ccay.security.role.ListRole
 * @description role 视图页面控制器
 * 
 * @since 2012-01-02
 * @param page
 *            该参数为控制器对象的内部别名，方便控制器内部的调用。外部访问不到，外部只能通过Ccay.security.role.GrantFunctionalPerm2Role访问其方法或属性
 */
Ccay.Module.define("Ccay.example.functionDemo.roleManage.ViewUsersAndGroups",function(page,$S){
	/**
	 * Grid初始化
	 */
	page.init=function(roleId){
		var grid1Options={
			noPage:true,
			height:240,
			// 列设置
			columns:[
			         {id: 'opration' , header:"ccay.common.label.operation",frozen:true,width:30,sortable:false,resizable:false,renderer:
						 function (value ,record){
			        	    return Ccay.UI.button("ccay.security.grant.rolePermission","Ccay.example.functionDemo.roleManage.showMsg(this)"
										,"Service$UserPermission$create,Service$UserPermission$update,Service$UserPermission$delete","img","key");
					 }},
				     {id: 'userAccount' , header: "ccay.common.label.userAccount",width:230,align:"left"},
				     {id: 'employeeNumber' , header:"ccay.security.label.userNumber",width:230 ,align:"left"},
				     {id: 'userCN' , header: "ccay.security.label.userCnname",width:230,align:"left"}
			],
			// Grid操作设置
			operation:{
				search:{
					// 查询请求地址
					url:"services/ccay/security/role/list/users/"+roleId
				}
			}
		}
		var grid2Options={
			noPage:true,
			height:240,
				// 列设置
				columns:[
				         {id: 'opration' , header:"ccay.common.label.operation",frozen:true,width:30,sortable:false,resizable:false,renderer:
							 function (value ,record){
				        	    return Ccay.UI.button("ccay.security.grant.rolePermission","Ccay.example.functionDemo.roleManage.showMsg(this)"
											,"Service$Group$create,Service$Group$update,Service$Group$delete","img","key");
						 }},
					     {id: 'name' , header: "ccay.security.label.groupName" ,width:220,align:"left"},
					     {id: 'type' , header:"ccay.security.label.groupType",width:220,align:"left",renderer:function(value){
						     	if(value == 'localGroup'){
						     		return $i18n("ccay.security.label.groupLocal");
						     	}}
					     },
					     {id: 'areaCode' , header: "ccay.security.label.groupDescription",width:220,align:"left"}					     
				],
				// Grid操作设置
				operation:{
					search:{
						// 查询请求地址
						url:"services/ccay/security/role/list/groups/"+roleId
					}
				}
			}
		// 初始化Grid
		$S("#usersGrid").ccayGrid(grid1Options);
		$S("#groupsGrid").ccayGrid(grid2Options);
	};
});





